package com.design.patterns.list.visitor.evaluation.objectstructure;

import com.design.patterns.list.visitor.evaluation.element.Person;
import com.design.patterns.list.visitor.evaluation.visitor.Auction;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

/**
 * @author Wangzhiwen
 */
public class PersonStructure {

    private List<Person> people = new LinkedList<>();

    public void add(Person... people){
        if (people != null && people.length != 0){
            this.people.addAll(Arrays.asList(people));
        }
    }


    public void remove(Person person){
        this.people.remove(person);
    }

    public void clean(){
        this.people.clear();
    }

    public void personResult(Auction auction){
        for (Person person : people) {
            person.accept(auction);
        }
    }
}
